# check wether mysql is listening
 netstat -an | grep 3306

# try to connect
# error: host a.b.c.d is not allowed to connect ot this server

PWD="hwtest"

echo ===========================================================================	
SQL="\
show databases; use mysql; \
select * from user;\
"
mysql -u root -p -e "$SQL"

echo ===========================================================================	
# http://help.hardhathosting.com/question.php/87
SUBNET_MINE=192.168.11.%
IP_MINE=192.168.11.102

echo ===========================================================================	
IP=$IP_MINE
SQL="\
GRANT ALL ON asterisk.* TO root@'$IP' IDENTIFIED BY '$PWD';
use mysql; \
select * from user; \
"
mysql -u root -p -e "$SQL"

echo ===========================================================================	
SQL="\
SHOW GRANTS FOR root@'%'; \
SHOW GRANTS FOR root;
"	
mysql -u root -p -e "$SQL"
echo ===========================================================================	



service mysqld restart ; cat /var/log/mysqld.log
service iptables stop ;  
chkconfig iptables off
chkconfig iptables --list




q| strings | perl -e '
while(<>) { chomp; next if /^[^ ]+[ ]*$/;
if(/^(SELECT|UPDATE|DELETE|INSERT|SET|COMMIT|ROLLBACK|CREATE|DROP|ALTER)/i) {
if (defined $q) { print "$q\n"; }
$q=$_;
} else {
$_ =~ s/^[ \t]+//; $q.=" $_";
}
}'

